<template>
  <view class="content-analyse">
    <view class="header">
      <up-row>
        <up-col span="12">
          <view class="header-left">
            {{ t("common.chargeAndDischargeAnalysis") }}
          </view>
        </up-col>
      </up-row>
    </view>

    <template v-if="Object.keys(chartOption).length !== 0">
      <EChartsWrapper :option="chartOption" />
    </template>
    <template v-else>
      <up-empty icon="/static/no-empty.png" :text="t('common.empty')">
      </up-empty>
    </template>
  </view>
</template>

<script setup>
import { ref, watch } from "vue";
import { useI18n } from "vue-i18n";
const { t } = useI18n();
const props = defineProps({
  suffChart: {
    type: Object,
    detail: {},
  },
});

// 定义图表配置项
const chartOption = ref();

watch(
  () => props.suffChart,
  (val) => {
    console.log("val---------", val);
    chartOption.value = val;
  },
  { immediate: true }
);
</script>

<style lang="scss" scoped>
.content-analyse {
  width: 100%;
  border-radius: 16rpx;
  background: #132034;
  padding: 32rpx 10rpx;
  box-sizing: border-box;
  .header {
    padding: 0rpx 39rpx;
    box-sizing: border-box;
    width: 100%;
    position: relative;
    .header-left {
      font-family: PingFangSC;
      font-size: 32rpx;
      font-weight: normal;
      color: #eeeeee;
    }
  }
  .header::after {
    content: "";
    position: absolute;
    left: -10rpx;
    top: 50%;
    transform: translateY(-50%);
    width: 8rpx;
    height: 32rpx;
    border-radius: 0px 8rpx 8rpx 0rpx;
    opacity: 1;
    background: #64b7f6;
  }
}
</style>
